<!--<?php print <<<EOT
-->
<html>
<head>
<title>Insert Image</title>
<script type="text/javascript" src="js/dialog.js"></script>
<script type="text/javascript">
window.resizeTo(400, 100);
function Init() {
  __dlg_init();
  var param = window.dialogArguments;
  if (param) {
      document.getElementById("f_url").value = param["f_url"];
      document.getElementById("f_alt").value = param["f_alt"];
      document.getElementById("f_border").value = param["f_border"];
      document.getElementById("f_align").value = param["f_align"];
      document.getElementById("f_vert").value = param["f_vert"];
      document.getElementById("f_horiz").value = param["f_horiz"];
      window.ipreview.location.replace(param.f_url);
  }
  document.getElementById("f_url").focus();
};
function onOK() {
  var required = {
    "f_url": "图片链接不能为空。"
  };
  for (var i in required) {
    var el = document.getElementById(i);
    if (!el.value) {
      alert(required[i]);
      el.focus();
      return false;
    }
  }
  var fields = ["f_url", "f_alt", "f_align", "f_border"];
  var param = new Object();
  for (var i in fields) {
    var id = fields[i];
    var el = document.getElementById(id);
    param[id] = el.value;
  }
  __dlg_close(param);
  return false;
};
function onCancel() {
  __dlg_close(null);
  return false;
};
function onPreview() {
  var f_url = document.getElementById("f_url");
  var url = f_url.value;
  if (!url) {
    alert("图片链接不能为空。");
    f_url.focus();
    return false;
  }
  window.ipreview.location.replace(url);
  return false;
};
</script>
<style type="text/css">
html, body {
  background: ButtonFace;
  color: ButtonText;
  font: 11px Tahoma,Verdana,sans-serif;
  margin: 0px;
  padding: 0px;
}
body { padding: 5px; }
table {font: 11px Tahoma,Verdana,sans-serif;}
select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
button { width: 70px; }
form { padding: 0px; margin: 0px; }
</style>
</head>
<body onload="Init()">
<form action="" method="get">
<table border="0" width="100%" style="padding: 0px; margin: 0px">
  <tbody>
  <tr>
    <td width="20%">图片链接:</td>
    <td>
		<input type="text" name="url" id="f_url" style="width:75%" />
		<button name="preview" onclick="return onPreview();">预览</button>
    </td>
  </tr>
  <tr>
    <td>文字描述:</td>
    <td><input type="text" name="alt" id="f_alt" style="width:100%" /></td>
  </tr>
  <tr>
    <td>对齐方式:</td>
    <td>
		<select size="1" name="align" id="f_align">
			<option value="">Not set</option>
			<option value="left">Left</option>
			<option value="right">Right</option>
			<option value="texttop">Texttop</option>
			<option value="absmiddle">Absmiddle</option>
			<option value="baseline" selected="1">Baseline</option>
			<option value="absbottom">Absbottom</option>
			<option value="bottom">Bottom</option>
			<option value="middle">Middle</option>
			<option value="top">Top</option>
		</select>
	</td>
  </tr>
  <tr>
    <td>边框:</td>
    <td><input type="text" name="border" id="f_border" size="5" /></td>
  </tr>
  </tbody>
</table>
<table width="100%" style="margin-bottom: 0.2em">
 <tr>
  <td valign="bottom">
    预览:<br />
    <iframe name="ipreview" id="ipreview" frameborder="0" style="border : 1px solid gray;" height="200" width="300" src=""></iframe>
  </td>
  <td valign="bottom" style="text-align: right">
    <button type="button" name="ok" onclick="return onOK();">提 交</button><br />
    <button type="button" name="cancel" onclick="return onCancel();">取消</button>
  </td>
 </tr>
</table>
</form>
</body>
</html>
<!--
EOT;
?>-->